package com.easylinkin.linkappapi.operatelog.controller;


import com.easylinkin.linkappapi.common.model.RequestModel;
import com.easylinkin.linkappapi.operatelog.entity.OperateLog;
import com.easylinkin.linkappapi.operatelog.service.OperateLogService;
import javax.annotation.Resource;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author TongJie
 * @since 2020-04-12
 */
@RestController
@RequestMapping("/operateLog")
public class OperateLogController {

    @Resource
    private OperateLogService operateLogService;

    @PostMapping("getPage")
    public RestMessage getPage(@RequestBody RequestModel<OperateLog> requestModel) {
        Assert.notNull(requestModel, "参数为空");
        Assert.notNull(requestModel.getPage(), "参数page为空");
        Assert.notNull(requestModel.getCustomQueryParams(), "customQueryParams参数为空");
        return RestBuilders.successBuilder().data(operateLogService.getPage(requestModel.getPage(),requestModel.getCustomQueryParams())).build();

    }

}
